package com.zys.http.processor.basic;

import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.List;

/**
 * @author zys
 * @since 2025-01-13
 */
public interface AnnotationProcessor {
    String NAME_KEY = "name";
    String VALUE_KEY = "value";
    List<String> DEFAULT_ANNO_VALUE = Collections.singletonList("");

    /**
     * @param element       PsiAnnotation or KtAnnotationEntry
     * @param qualifiedName 注解的全限名
     * @return /
     */
    boolean isTargetAnnotation(PsiElement element, String qualifiedName);

    /**
     * @param element PsiAnnotation or KtAnnotationEntry
     * @return 注解指定键的值
     */
    default String annotationValue(PsiElement element, String[] attributeNames) {
        return annotationValues(element, attributeNames).get(0);
    }

    /**
     * @param element PsiAnnotation or KtAnnotationEntry
     * @return 注解指定键的值
     */
    @NotNull List<String> annotationValues(PsiElement element, String[] attributeNames);
}
